package com.yootk.vo;

import com.yootk.common.validation.annotation.RegexValidator;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Digits;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;

@Data
public class Message2 {

    //@NotBlank(message = "消息标题不允许为空！")
    @NotBlank(message = "{message.title.notblank.error}")
    private String title;

    //@NotNull(message = "消息发布日期数据不允许为空！")
    @NotNull(message = "{message.pubdate.notnull.error}")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date pubdate;

    //@NotBlank(message = "消息内容不允许为空！")
    @NotBlank(message = "{message.content.notblank.error}")
    private String content;

    //@Email(message = "消息发送的邮箱格式错误！")
    @Email(message = "{message.email.email.error}")
    private String email;

    //@Digits(integer = 1, fraction = 0, message = "消息级别只能是一位整数！")
    @Digits(integer = 1, fraction = 0, message = "{message.level.digits.error}")
    private Integer level;  // 消息级别

    @NotBlank(message = "{message.flag.notblank.error}")
    @RegexValidator(pattern = "[a-zA-Z]{1,5}-\\d{1,3}", message = "{message.flag.regex.error}")
    private String flag;    // 消息标记，例如：yootk-101
}
